# -*- encoding:utf-8 -*-
# !/usr/bin/env python
'''
    python-0806-05.py
    ======================
    @descript: 变量遮蔽的问题
    @copyright:nnz
    @author:dln
    @date: 2021/8/9 14:40
    @version:v1.0
'''
v_01='全局变量'     #全局变量
def fun_01():
    v_01='局部变量'
    def fun_02():
        print(v_01)
        v_01='内部函数里的变量'
        pass
    pass
v_01='全局变量'     #全局变量
def fun_01():
    v_01='局部变量'
    def fun_02():
        global v_01
        print(v_01)
        v_01='内部函数里的变量'
        pass
    pass
fun_01()
print(v_01)

def fun_01():
    v_01='局部变量'
    def fun_02():
        nonlocal v_01
        print(v_01)
        v_01='内部函数里的变量'
        pass
    pass
fun_01()
print(v_01)